package com.etop.ondoc.dao;

import org.hibernate.Session;

import com.etop.ondoc.beans.User;

@SuppressWarnings("unchecked")
public class UserDao extends BaseDao<User> {
	//SINGLETON
	private static class Singleton{
		public static UserDao instance = new UserDao();
	}
	public static UserDao getInstance(){
		return (Singleton.instance);
	}
	public User loadByUsername(String username) {
		Session  session = this.getSession();
        User user = (User) session.createQuery("from User where username=:username")
                .setString("username", username)
                .uniqueResult();
        return user;
    }
}
